package com.shu.jdk;

import org.openjdk.jol.info.ClassLayout;

import java.util.concurrent.TimeUnit;

/**
 * @author ssm
 * @version V1.0
 * @description:
 * @date 2021/8/16 15:24
 */

public class PaddingTest {

    private int a;
    private int c;
    private String b;

    public static void main(String[] args) throws InterruptedException {
        PaddingTest paddingTest = new PaddingTest();
        System.out.println(ClassLayout.parseInstance(paddingTest).toPrintable());

        int i = 5;
        for (int i1 = 0; i1 < i; i1++) {
            synchronized (paddingTest){
                System.out.println(ClassLayout.parseInstance(paddingTest).toPrintable());
                TimeUnit.SECONDS.sleep(1);
            }
        }

        new Thread(()->{
            synchronized (paddingTest){
                System.out.println("xxxx" + ClassLayout.parseInstance(paddingTest).toPrintable());
//                try {
//                    TimeUnit.SECONDS.sleep(3);
//                } catch (InterruptedException e) {
//                    e.printStackTrace();
//                }
            }
        }).start();



    }
}
